﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace DemoPrism.Services
{
    public class LanguageService : ILanguageService
    {
        private string _currentLanguage = "zh-CN";

        public event Action LanguageChanged;

        public string GetCurrentLanguage() => _currentLanguage;

        public void SetLanguage(string languageCode)
        {
            _currentLanguage = languageCode;
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(languageCode);
            LanguageChanged?.Invoke();
        }

        public string GetTranslation(string key)
        {
            // 实际实现中应该从资源文件获取翻译
            return Application.Current.FindResource(key)?.ToString() ?? key;
        }
    }
}
